package cn.hanxiaojun.action;

import java.sql.SQLException;

import cn.hanxiaojun.imple.Add;
import cn.hanxiaojun.model.Desk;

import com.opensymphony.xwork2.ActionSupport;

public class AddDeskAction extends ActionSupport
{
	
	//属性驱动。与saveBorad.jsp页面里的input里面的name属性值对应相同。
	String bid;
	String bname;
	String bstatus;
	String btype;
	String btime;
	
	public String execute() throws SQLException
	{
		Desk desk=new Desk();//填充model，desk对象一开始是空的。
		
		//把从jsp页面输入的值放到desk对象里面.
		desk.setT_id(bid);  
		desk.setT_name(bname);
		desk.setT_status(bstatus);
		desk.setT_type(btype);
		desk.setT_time(btime);
			
		//System.out.println(desk.getT_id()+" "+desk.getT_name());
		
		Add add=new Add();// 声明imple包里的Add类的一个对象。
		int biaozhi=add.Adddata(desk);//把desk对象(里面有许多数据)传过去进行增加处理。处理后返回一个标志0或1。
		if(biaozhi==1){    
			return SUCCESS;
		}else{
			return "no";
		}
				
	}
	
	//下面是生成填写数据的get和set方法。
	public String getBid() {
		return bid;
	}

	public void setBid(String bid) {
		this.bid = bid;
	}

	public String getBname() {
		return bname;
	}

	public void setBname(String bname) {
		this.bname = bname;
	}

	public String getBstatus() {
		return bstatus;
	}

	public void setBstatus(String bstatus) {
		this.bstatus = bstatus;
	}

	public String getBtype() {
		return btype;
	}

	public void setBtype(String btype) {
		this.btype = btype;
	}

	public String getBtime() {
		return btime;
	}

	public void setBtime(String btime) {
		this.btime = btime;
	}	
}
